package com.esisa.IHM;

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.esisa.beans.ListeSCORM;
import com.esisa.listners.Alpha;
import com.esisa.listners.ChooseFile;
import com.esisa.listners.CopyPastListner;
import com.esisa.listners.ExitAction;
import com.esisa.listners.Save;
import com.esisa.swing.ButtonPanel;
import com.esisa.swing.Form;

public class NewDocument extends JFrame {

	public NewDocument() {
		exp01();
		setSize(500, 550);
		pack();
		//setResizable(false);
		setVisible(true);
	}
	
	void exp01(){
		ListeSCORM liste = new ListeSCORM();
		liste.load("resources/doc.txt");
		setTitle("Nouveau Etudiant");
		Form f=new Form(new String[]{"Nom","Prenom","Chemin","Age","Absence","Presence","Retard","Remarque"});
		
		f.addMouseListener(new CopyPastListner());
	//	f.AddKeyListner("Source :", (KeyListener) new Ouvrir() );
	
		JPanel paneau=new JPanel();
		paneau.setLayout(new BorderLayout());
		paneau.add(f);
		ButtonPanel b=new ButtonPanel(new String[]{"Valider","Fermer","Selectionner une photo"});
		b.addActionListner(new ChooseFile(f), "Selectionner une photo");
		b.addActionListner(new Save(liste, f), "Valider");
		b.addActionListner(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				dispose();
			}
		}, "Fermer");
		paneau.add(b, "South");
		
		//Ouvrir ouvrir=new Ouvrir();
	//	paneau.add(ouvrir, "North");
		
		setContentPane(paneau);
		
	}
	
	public static void main(String[] args) {
		new NewDocument();
	}



}
